// 柯里化案例
// ''.match(/\s+/g)
// ''.match(/\d+/g)
const _ = require('lodash')


// 提取数组中苦有空白字符的元素
const match = _.curry((reg,str)=>str.match(reg))

const haveSpace = match(/\s+/g)
const haveNumber = match(/\d+/g)

const filter = _.curry((fn,array)=>array.filter(fn))

const findSpace = filter(haveSpace)
const findNumber = filter(haveNumber)

console.log(findSpace(['John Connor', 'John_Donne']))
console.log(findNumber(['123adfsafds', 'John_Donne']))